package com.lovo.homework7_14ATM;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LoginPanel extends JPanel implements ActionListener {

    private JButton jButton;
    private JTextField  jTextField;
    private JLabel jLabel1;
    private JLabel jLabel2;
    private JPasswordField jPasswordField;

    private Icon buttonIcon =util.Util.getIcon("/images/buttonLand.jpg");



    private ATMmain atMmain;

    public LoginPanel(ATMmain atMmain){
        this.atMmain =atMmain;
        this.setLayout(null);

        this.setOpaque(false);

        jLabel1=new JLabel("账户");
        jLabel1.setBounds(400,280,50,50);
        jLabel1.setForeground(Color.blue);
        jLabel1.setFont(new Font("宋体",Font.BOLD,20));
        this.add(jLabel1);
        jTextField = new JTextField("");
        jTextField.setBounds(500,285,200,30);
        this.add(jTextField);

        jLabel2=new JLabel("密码");
        jLabel2.setBounds(400,385,50,50);
        jLabel2.setFont(new Font("宋体",Font.BOLD,20));
        jLabel2.setForeground(Color.blue);
        this.add(jLabel2);
        jPasswordField = new JPasswordField("");
        jPasswordField.setBounds(500,390,200,30);
        this.add(jPasswordField);

        jButton = new JButton(buttonIcon);
        jButton.setBounds(450,460,140,50);
        this.add(jButton);

        jButton.addActionListener(this);
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource()==jButton){
            atMmain.switchPanel("menuPanel");
        }
    }
}
